package com.jiazhong.basic.shuxin.design.工厂模式.简单工厂模式;

import com.jiazhong.basic.shuxin.design.工厂模式.IPhone;
import com.jiazhong.basic.shuxin.design.工厂模式.MetaPhone;
import com.jiazhong.basic.shuxin.design.工厂模式.MiPhone;
import com.jiazhong.basic.shuxin.design.工厂模式.Phone;

public class PhoneFactory {

    public static Phone makePhone(String type) {
        return switch (type) {
            case "苹果" -> new IPhone();
            case "小米" -> new MiPhone();
            case "华为" -> new MetaPhone();
            default -> null;
        };
    }
}
